<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>招聘待办任务列表</title>
	<jsp:include page="/common/head.jsp"></jsp:include>
	<%@include file="/common/include-jquery-ui.jsp"%>
	<%@include file="/common/include-bootstrap.jsp"%>
  
    <script src="${ctx}/js/activiti/workflow.js" type="text/javascript"></script>
    <script>
        $(function () {
            $('.trace').click(function(){
                var pid= $(this).attr('pid');
                var pdid= $(this).attr('pdid');
                var url = "/diagram-viewer/index.html?processDefinitionId="+pdid+"&processInstanceId="+pid;
                dialog({
                    fixed:true,
                    quickClose:true,
                    title : "流程跟踪",
                    width:$(".main-content").width()-300,
                    height:500,
                    content : "<iframe scrolling=\"auto\" frameborder=\"0\"  src=\""+url+"\" style=\"width:100%;height:100%;\"></iframe>"
                }).show();
            });
        });
    </script>		
	
    <script type="text/javascript">
        var processType = '${empty processKey ? param.processKey : processKey}';
    </script>	
    <script src="${ctx}/js/form/dynamic/dynamic-form-creator.js" type="text/javascript"></script>
	<script src="${ctx}/js/form/dynamic/dynamic-form-handler.js" type="text/javascript"></script>
</head>
<body>
<section class="main-content">
    <div class="content-wrap">
   		 <!-- 办理任务对话框 -->
		<div id="handleTemplate" class="template"></div>
        <section class="panel panel-default">
            <div class="panel-heading">
                <b>招聘待办任务列表</b>
                <small class="pull-right">
                    <a href="javascript:window.location.reload();" class="pd-r-xs"><i class="fa fa-refresh"></i> 刷新</a>
                </small>
            </div>
            <div class="panel-body">
            
	            <c:if test="${not empty message}">
					<div id="message" class="alert alert-success">${message}</div>
					<!-- 自动隐藏提示信息 -->
					<script type="text/javascript">
					setTimeout(function() {
						$('#message').hide('slow');
					}, 5000);
					</script>
				</c:if>
                <table class="table">
                    <thead>
                        <tr>
                            <th>部门</th>
                            <th>发布人</th>
                            <th>申请时间</th>
                            <th>开始时间 -- 结束时间</th>
                            <th>当前节点</th>
                            <th>流程开始时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <c:forEach items="${page.items}" var="leave">
                            <c:set var="task" value="${leave.task }"/>
                            <c:set var="pi" value="${processInstance}"/>
                            <tr>
                                <td>${leave.depName}</td>
                                <td>${leave.userId}</td>
                                <td><fmt:formatDate pattern="YYYY/MM/dd HH:mm"  value="${leave.createTime}" /></td>
                                <td><fmt:formatDate pattern="YYYY/MM/dd"  value="${leave.startTime}" /> -- <fmt:formatDate pattern="YYYY/MM/dd"  value="${leave.endTime}" /></td>
                                <td>
                                    <a href="javascript:;" class="trace"  pid="${pi.id}" pdid="${pi.processDefinitionId}" title="点击查看流程图">${task.name }</a>
                                </td>
                                <td><fmt:formatDate pattern="YYYY/MM/dd HH:mm"  value="${task.createTime}" /></td>
                                <td>
                                    <c:if test="${empty task.assignee }">
                                        <a href="javascript:;" url="${ctx }/oa/position/task/claim/${task.id}" data-info="签收为我办理?" class="ajax-get label label-info">签收</a>
                                    </c:if>                                   
                                    <c:if test="${not empty task.assignee }">
										<%-- 此处用tkey记录当前节点的名称 --%>
										<a class="handle label label-success" tkey='${task.taskDefinitionKey }' tname='${task.name }' tid='${task.id }' href="javascript:;"  >办理</a>
									</c:if>
                                    <c:if test="${not empty task.assignee }">
                                        <a href="javascript:;" url="${ctx }/oa/position/task/complete/${task.id}" data-info="确认办理?" class="ajax-get label label-success">通过</a>

                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
                <div class="clearfix">
                    <div class="pull-right">
                        <mt:pager pageSize="${page.size}" pageNo="${page.index}" url="" recordCount="${page.totalRecord}" />
                    </div>
                </div>
            </div>            
            </section> 
        </div>
        
        
    </section>
</body>
</html>